package com.example.aninterface;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private List<Me> meList = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initMe();
        MeAdapter adapter = new MeAdapter(MainActivity.this, R.layout.me_iitem, meList);
        ListView listView =(ListView) findViewById(R.id.list_view);
        listView.setAdapter(adapter);
    }
    private void initMe(){
        Me me = new Me("Me",R.drawable.a);
        meList.add(me);
        Me shoucang = new Me("Shoucang",R.drawable.b);
        meList.add(shoucang);
        Me xiangce = new Me("Xiangce",R.drawable.c);
        meList.add(xiangce);
        Me xiangji = new Me("Xiangji",R.drawable.d);
        meList.add(xiangji);
        Me shezhi = new Me("Shezhi",R.drawable.e);
        meList.add(shezhi);
    }
}
